<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="base.jsp" %>
<div class="navbar navbar-fixed-top">
		<div class="navbar-inner">
			<div class="container-fluid">
				<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
				</a>
				<a class="brand" href="#" style="color:#E5E0E8">CRM</a>
				<div class="nav-collapse">
		  		<ul class="nav">
						<li class="divider-vertical"></li>
						<li class="${param.tag == 'main' ? 'active' : ''}"><a href="#main">概览</a></li>
						<li class="divider-vertical"></li>
						<li class="${param.tag == 'contact' ? 'active' : ''}"><a href="${basePath }/contact/contacts.action">通讯录</a></li>
						<li class="divider-vertical"></li>
						<li class="${param.tag == 'task' ? 'active' : ''}"><a href="#task">任务</a></li>
						<li class="divider-vertical"></li>
						<li class="${param.tag == 'deal' ? 'active' : ''}"><a href="#deal">机会</a></li>
						<li class="divider-vertical"></li>
						<li class="divider-vertical"></li>
			    </ul>
					
				<ul class="nav">
					  <li class="dropdown">
							<a href="#" class="dropdown-toggle" data-toggle="dropdown">
						    添加
						    <span class="caret"></span>
						  </a>
						  <ul class="dropdown-menu new-actions">
						    <li><a href="${basePath }/contact/add.action?t=contact"><i class="icon-person"></i> 联系人</a></li>
								<li><a href="${basePath }/contact/add.action?t=company"><i class="icon-company"></i> 公司</a></li>
								<li class="divider"></li>
								<li><a data-toggle="modal" href="#taskModal"><i class="icon-ok"></i> 任务</a></li>
								<li><a href="添加机会.htm"><i class="icon-dollar"></i> 机会</a></li>
						  </ul>
						</li>
				</ul>
				
					<ul class="nav">
						<li class="divider-vertical"></li>
					</ul>
					
					<form class="navbar-search">
						<input type="text" name="search" id="search" class="search-query mp_input " placeholder="搜索联系人或机会" autocomplete="off">
						<ul class="typeahead dropdown-menu mp_list" style="display: none; "></ul>
					</form>
					
					<ul class="nav pull-right">
						<li class=""><a href="username">${sessionScope.user.username }</a></li>
						<li class=""><a href="setting">管理</a></li>
						<li class="divider-vertical"></li>
						<li class=""><a href="users/sign_out">退出</a></li>
					</ul>
				</div>
		  </div>
	  </div>
  </div>
  
  	<div class="modal hide" id="taskModal">
		<form accept-charset="UTF-8" action="#task" class="simple_form new_schedule" data-remote="true" id="task_form" method="post" novalidate="novalidate">	
			
			<input id="context" name="context" type="hidden" value="tasks">
			<input id="schedule_contact_id" name="schedule[contact_id]" type="hidden">
			<input id="schedule_deal_id" name="schedule[chance_id]" type="hidden">
			<input id="form_user_id" name="user_id" type="hidden">
			<input id="filter_task_category_id" name="filter_task_category_id" type="hidden">
			
			<div class="modal-header">
				<a class="close" data-dismiss="modal">×</a>
				<h3>添加一个任务</h3>
			</div>
			
			<div class="modal-body">
				<div class="control-group string optional">
					<div class="controls">
						<input class="string optional span5" id="schedule_name" name="schedule[name]" size="50" type="text" placeholder="请输入任务名称">
					</div>
				</div>
			
				<div class="control-group string optional">
					<label class="string optional control-label" for="schedule_frame"> 到期时间？</label>
					<div class="controls">
						<select id="task_frame" name="schedule[frame]" onchange="change_task_frame($(this).val(), '#calendar_date_select')">
							<option value="today" selected="selected">今天</option>
							<option value="tomorrow">明天</option>
							<option value="this_week">本周</option>
							<option value="next_week">下周</option>
							<option value="later">以后</option>
							<option value="calendar">设置具体时间 ...</option>
						</select>
						<span id="calendar_date_link" class="hide">
							
						</span>
					</div>
				</div>		
				<input type="text" name="Time" id="calendar_date_select" onClick="Calendar('calendar_date_select')"  class=" span4" placeholder="请输入具体时间" style="display:none; ">
				
				<div class="control-group integer optional">
					<label class="integer optional control-label" for="schedule_category_id"> 选择一个分类</label>
					<div class="controls">
						<select data="TaskCategory" id="schedule_category_id" name="schedule[category_id]" onchange="changeCategory(this)">
							<option value="">无</option>
							<option value="29465">电话</option>
							<option value="29466">邮件</option>
							<option value="29467">传真</option>
							<option value="29468">面谈</option>
							<option value="29469">感谢</option>
							<option value="29470">试用</option>
							<option value="new">添加分类 ...</option>
						</select>
							<a href="#edittasktype">编辑分类</a>
					</div>
				</div>	
				
					<input id="schedule_assigned_to_id" name="schedule[assigned_to_id]" type="hidden" value="6641">
					<input id="schedule_privacy" name="schedule[privacy]" type="hidden" value="private">
			
			</div>
			
			<div class="modal-footer" style="text-align:left;">
				<input class="btn btn-primary" name="commit" type="submit" value="添加这个任务">
				<a href="#" class="btn" data-dismiss="modal">取消</a>
			</div>
		</form>
	</div>
	
	<script type="text/javascript" charset="utf-8">
			$("#taskModal").on('shown', function() {
				$('#task_name').focus();
			});
		</script>